🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators asString
Created by Alexandra on 2017-08-13 · Last edited by Colline.ssali on 2025-12-12.

The string representation of the class – the asString operation is available on everything.


asString operator converts a value into a string representation. It is a type-conversion (casting) operation. It does not change the actual data type of the attribute — it only converts it in the expression result

Example:

123->asString()

It converts a value in a string form

123

Applying asString operator on Date type in a class object

Employee.allinstances->collect(x|x.DateOfBirth.asString())
Documentation OCLOperators asString 1765521670145.png





Please read here onperformance when using asString.